<template>
   <div class="app-container">
      <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" @submit.native.prevent>
         <el-form-item label="机构名称" prop="name">
            <el-input
               v-model="queryParams.name"
               placeholder="机构名称"
               clearable
               style="width: 200px"
                @keyup.enter="handleQuery"
            />
         </el-form-item>
  
         <el-form-item label="机构编号" prop="code">
            <el-input
               v-model="queryParams.code"
               placeholder="机构编号"
               clearable
               style="width: 200px"
                @keyup.enter="handleQuery"
            />
         </el-form-item>
         <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetQuery">重置</el-button>
         </el-form-item>
      </el-form>

      <el-table v-loading="loading" :data="dataList" >
         <el-table-column type=index min-width='20' label="序号" >
          <template  #default="scope">
            <span>{{(queryParams.pageNum- 1) * queryParams.pageSize + scope.$index + 1}}</span>
          </template>
 </el-table-column>
         <el-table-column
            label="机构名称"
            align="center"
            prop="name"
            :show-overflow-tooltip="true">
            <template #default="scope">
               <el-button link type="primary" @click="openUnintInfo(scope.row.id)">{{scope.row.name}}</el-button>
            </template> 
             
           </el-table-column>
          <el-table-column label="机构编号" align="center" prop="code" width="150">
            <!-- <template #default="scope">
               <dict-tag :options="sys_notice_type" :value="scope.row.noticeType" />
            </template> -->
         </el-table-column>
         <el-table-column label="负责人" align="center" prop="charger" width="150">
         </el-table-column>
          <el-table-column label="机构级别" align="center" prop="level" width="150" />
        <el-table-column label="机构人员" align="center" prop="personNum" width="150"/>
       
         <el-table-column label="科研项目" align="center" prop="projectNum" width="200"/>
              <el-table-column label="科研成果" align="center" prop="productNum" width="200"/>
   
       <el-table-column label="科研获奖" align="center" prop="honorNum" width="200"/>
      
  
      </el-table>

      <pagination
         v-show="total > 0"
         :total="total"
         v-model:page="queryParams.pageNum"
         v-model:limit="queryParams.pageSize"
         @pagination="getList"
      />
   </div>

     <UnitModal :opType='3' :opUnitId="opUnitId" v-model="unitModalVisible" v-if="unitModalVisible"/>
</template>

<script setup name="ResearchPlatformList">

const { proxy } = getCurrentInstance();

import * as homeApi  from "@/api/home/index";
import UnitModal from "@/views//research/components/UnitModal.vue";
const ViewPageRef =ref()
const router = useRouter();
const dataList = ref([]);
const unitModalVisible=ref(false)
const opUnitId=ref();
const queryParams=reactive({
     pageNum: 1,
    pageSize: 10,
    name: "",
    code: "",
    orderByColumn: undefined,
    
})

const open = ref(false);
const loading = ref(true);
const showSearch = ref(true);

const total = ref(0);
const title = ref("");


/** 查询待办列表 */
function getList() {
  loading.value = true;
   homeApi.getKyptList(queryParams).then(response => {
    dataList.value = response.rows;
    total.value = response.total;
    loading.value = false;
  });
}

const   openUnintInfo=(id)=>{
   unitModalVisible.value=true;
   opUnitId.value=id
   console.log(opUnitId.value,unitModalVisible.value)

}
/** 搜索按钮操作 */
function handleQuery() {

  queryParams.pageNum = 1;
  getList();
}

/** 重置按钮操作 */
function resetQuery() {
  proxy.resetForm("queryRef");
  handleQuery();
}

onMounted(() => {

  getList();
})



</script>
